home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / greps.zip / CONFIG~1 < prev    next >
Text File  |  1993-09-17  |  9KB  |  303 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp]
  21. #        [--prefix=PREFIX] [--exec_prefix=PREFIX] [--with-PROGRAM] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, and --exec_prefix.
  23.  
  24. trap 'rm -f conftest* core; exit 1' 1 3 15
  25.  
  26. for arg in $*; do
  27.   # Handle --exec_prefix with a space before the argument.
  28.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  29.   # Handle --host with a space before the argument.
  30.   elif test x$next_host = xyes; then next_host=
  31.   # Handle --prefix with a space before the argument.
  32.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  33.   # Handle --srcdir with a space before the argument.
  34.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  35.   else
  36.     case $arg in
  37.      -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
  38.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  39.      -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
  40.     next_exec_prefix=yes ;;
  41.  
  42.      -gas | --gas | --ga | --g) ;;
  43.  
  44.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  45.      -host | --host | --hos | --ho | --h)
  46.     next_host=yes ;;
  47.  
  48.      -nfp | --nfp | --nf | --n) ;;
  49.  
  50.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  51.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  52.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  53.     next_prefix=yes ;;
  54.  
  55.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  56.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  58.     next_srcdir=yes ;;
  59.  
  60.      -with-* | --with-*) ;;
  61.  
  62.      *) ;;
  63.     esac
  64.   fi
  65. done
  66.  
  67. test -z "$exec_prefix" && exec_prefix='$(prefix)'
  68.  
  69. INCLUDEDIR=${INCLUDEDIR-/usr/include}
  70.  
  71. rm -f conftest*
  72. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  73.  
  74. # A filename unique to this package, relative to the directory that
  75. # configure is in, which we can look for to find out if srcdir is correct.
  76. unique_file=grep.c
  77.  
  78. # Makefile rules whose targets are searched for in VPATH need to use $<.
  79. # However, old makes do not support it, so we use a combination
  80. # construction in Makefile.in: `$file<'.
  81. # If srcdir is `.', we use sed to change that to `file' for old makes.
  82. # Otherwise, we use sed to change it to `$<'.
  83. # vpsub is the sed program, which changes `$file<' to one or the other.
  84. vpsub='s,\$\([-./a-zA-Z0-9_][-./a-zA-Z0-9_]*\)<,\1,g'
  85. # srsub changes `@srcdir@' in Makefile.in into either `.' or the path
  86. # of the top of the source tree for the package.
  87. srsub='s,@srcdir@,.,'
  88.  
  89. # Find the source files, if location was not specified.
  90. if test -z "$srcdir"; then
  91.   srcdirdefaulted=yes; srcdir=.
  92.   if test ! -r $unique_file; then srcdir=..; fi
  93. fi
  94. if test ! -r $srcdir/$unique_file; then
  95.   if test x$srcdirdefaulted = xyes; then
  96.     echo "configure: Can not find sources in \`.' or \`..'." 1>&2
  97.   else
  98.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  99.   fi
  100.   exit 1
  101. fi
  102. if test $srcdir != .; then
  103.   VPATH='VPATH = $(srcdir)'
  104.   case $srcdir in
  105.     /*|~*) ;;
  106.     *) srcdir=`pwd`/$srcdir ;; # Make relative path absolute.
  107.   esac
  108.   vpsub='s,\$\([-./a-zA-Z0-9_][-./a-zA-Z0-9_]*\)<,\$<,g'
  109.   srsub="s,@srcdir@,$srcdir,"
  110. fi
  111.  
  112.  
  113. # The Bourne shell writes "command not found" to /dev/tty, so if we get
  114. # a usage message on stderr, we have the program.
  115. #
  116. # ksh and zsh write "command not found" to stderr, but test -n does not
  117. # want any output if there is no program.  So we use the `type' builtin
  118. # instead for them (and bash).
  119. if test "$RANDOM" = "$RANDOM"; then
  120.   checkfor='test -n "`$checkprog $checkargs 2>&1`"'
  121. else
  122.   checkfor='type $checkprog >/dev/null 2>&1'
  123. fi
  124.  
  125. echo checking for gcc
  126. checkprog=gcc checkargs=''
  127. test -z "$CC" && eval $checkfor && CC='gcc '
  128. CC=${CC-cc}
  129.  
  130. # Find out if we are using GNU C, under whatever name.
  131. cat <<EOF > conftest.c
  132. main() {
  133. #ifdef __GNUC__
  134.   exit(0);
  135. #else
  136.   exit(1);
  137. #endif
  138. }
  139. EOF
  140. eval $compile
  141. if test -s conftest && (./conftest) 2>/dev/null; then
  142.   GCC=1 # For later tests.
  143.   CC="$CC -O"
  144. else
  145.   :
  146. fi
  147. rm -f conftest*
  148.  
  149. echo checking for install
  150. # Make sure to not get the incompatible SysV /etc/install and
  151. # /usr/sbin/install, which might be in PATH before a BSD-like install.
  152. if test -z "$INSTALL"; then
  153.   saveifs="$IFS"; IFS="$IFS:"
  154.   for dir in $PATH; do
  155.     test -z "$dir" && dir=.
  156.     case $dir in
  157.     /etc|/usr/sbin) ;;
  158.     *)
  159.       if test -f $dir/install; then
  160.     INSTALL="$dir/install -c"
  161.     INSTALL_PROGRAM='$(INSTALL)'
  162.     INSTALL_DATA='$(INSTALL) -m 644'
  163.     break
  164.       fi
  165.       ;;
  166.     esac
  167.   done
  168.   IFS="$saveifs"
  169. fi
  170. INSTALL=${INSTALL-cp}
  171. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  172. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  173.  
  174. echo checking for ANSI C header files
  175. test -r $INCLUDEDIR/stdlib.h && test -r $INCLUDEDIR/string.h &&
  176.   test -r $INCLUDEDIR/limits.h && DEFS="$DEFS -DSTDC_HEADERS=1"
  177.  
  178. echo checking for BSD string and memory functions
  179. echo "#include <strings.h>
  180. main() { exit(0); } t() { rindex(0, 0); bzero(0, 0); }" > conftest.c
  181. eval $compile
  182. if test -s conftest && (./conftest) 2>/dev/null; then :
  183. else
  184.   DEFS="$DEFS -DUSG=1"
  185. fi
  186. rm -f conftest*
  187.  
  188. echo checking for unistd.h
  189. test -f $INCLUDEDIR/unistd.h && DEFS="$DEFS -DHAVE_UNISTD_H=1"
  190.  
  191. echo checking for unsigned characters
  192. cat <<EOF > conftest.c
  193.  
  194. /* volatile prevents gcc2 from optimizing the test away on sparcs.  */
  195. #if !__STDC__
  196. #define volatile
  197. #endif
  198. main() {
  199. #ifdef __CHAR_UNSIGNED__
  200.   exit(1); /* No need to redefine it.  */
  201. #else
  202.   volatile char c = 255; exit(c < 0);
  203. #endif
  204. }
  205. EOF
  206. eval $compile
  207. if test -s conftest && (./conftest) 2>/dev/null; then
  208.   DEFS="$DEFS -D__CHAR_UNSIGNED__=1"
  209. else
  210.   :
  211. fi
  212. rm -f conftest*
  213.  
  214. decl="#ifdef __GNUC__
  215. #define alloca __builtin_alloca
  216. #else
  217. #ifdef sparc
  218. #include <alloca.h>
  219. #else
  220. #ifdef _AIX
  221.  #pragma alloca
  222. #else
  223. char *alloca ();
  224. #endif
  225. #endif
  226. #endif
  227. "
  228. echo checking for alloca
  229. echo "$decl
  230. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  231. eval $compile
  232. if test -s conftest && (./conftest) 2>/dev/null; then :
  233. else
  234.   alloca_missing=1
  235. fi
  236. rm -f conftest*
  237.  
  238. if test -n "$alloca_missing"; then
  239.   SAVELIBS="$LIBS"
  240.   # Maybe alloca is in a different library.
  241.   if test -f /usr/ucblib/libucb.a; then
  242.     LIBS="$LIBS -L/usr/ucblib -lucb" trylib=-lucb # SVR4
  243.   elif test -f /lib/libPW.a; then
  244.     LIBS="$LIBS -lPW" trylib=-lPW # SVR2 and SVR3
  245.   fi
  246.   if test -n "$trylib"; then
  247.     alloca_missing=
  248.     echo checking for alloca in $trylib
  249. echo "$decl
  250. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  251. eval $compile
  252. if test -s conftest && (./conftest) 2>/dev/null; then :
  253. else
  254.   alloca_missing=1
  255. fi
  256. rm -f conftest*
  257.  
  258.   fi
  259.   if test -n "$alloca_missing"; then
  260.     LIBS="$SAVELIBS" ALLOCA=alloca.o
  261.   fi
  262. fi
  263.  
  264. trap 'rm -f Makefile config.status; exit 1' 1 3 15
  265.  
  266. if test -n "$prefix"; then
  267.   prsub="s,^prefix[     ]*=.*$,prefix = $prefix,
  268. s,^exec_prefix[     ]*=.*$,exec_prefix = $exec_prefix,"
  269. fi
  270.  
  271. for file in Makefile; do
  272.   # Not all systems have dirname.
  273.   dir=`echo $file|sed 's,/[^/][^/]*$,,'`
  274.   test "$dir" != "$file" && test ! -d $dir && mkdir $dir
  275.   echo creating $file
  276.   echo "# Generated automatically from `basename $file`.in by configure." > $file
  277.   sed -e "
  278. $vpsub
  279. $srsub
  280. s,@VPATH@,$VPATH,
  281. $prsub
  282. s,@CC@,$CC,
  283. s,@INSTALL@,$INSTALL,
  284. s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,
  285. s,@INSTALL_DATA@,$INSTALL_DATA,
  286. s,@ALLOCA@,$ALLOCA,
  287. s,@DEFS@,$DEFS,
  288. s,@LIBS@,$LIBS,
  289. " $srcdir/${file}.in >> $file
  290. echo "
  291. # Prevent GNU make v3 from overflowing arg limit on SysV.
  292. .NOEXPORT:" >> $file
  293. done
  294.  
  295. echo creating config.status
  296. rm -f config.status
  297. echo "#!/bin/sh
  298. # Generated automatically by configure.
  299. # Run this file to recreate the current configuration.
  300. $0 $*" > config.status
  301. chmod +x config.status
  302.  
  303.